﻿using Messhall.Framework.Domain.DomainObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Messhall.Domain.Permission.BusinessObjects
{
    public class AccountEntity : EntityBoBase
    {
        #region 成员变量

        /// <summary>
        /// 用户Id
        /// </summary>
        public Guid UsersKeyId { get; set; }

        /// <summary>
        /// 账号Code（如：手机号）
        /// </summary>
        public string OpenCode { get; set; }

        /// <summary>
        /// 账号类型
        /// </summary>
        public int Type { get; set; }

        #endregion
    }

    public class Account : BoBase, IAggregateRoot
    {
        private AccountEntity SelfEntity
        {
            get { return Entity as AccountEntity; }
            set { this.Entity = value; }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="entity"></param>
        public Account(Guid usersKeyId, string openCode, int type)
        {
            this.SelfEntity = new AccountEntity()
            {
                UsersKeyId = usersKeyId,
                OpenCode = openCode,
                Type = type
            };
        }

        public Account(AccountEntity entity)
        {
            this.SelfEntity = entity;
        }

        public void SetUsersKeyId(Guid userKeyId)
        {
            this.SelfEntity.UsersKeyId = userKeyId;
        }

        public Guid GetUserKeyId()
        {
            return this.SelfEntity.UsersKeyId;
        }

        public string GetOpenCode()
        {
            return this.SelfEntity.OpenCode;
        }

        public void SetOpenCode(string openCode)
        {
            this.SelfEntity.OpenCode = openCode;
        }

        public int GetType()
        {
            return this.SelfEntity.Type;
        }

        public void SetType(int type)
        {
            this.SelfEntity.Type = type;
        }
    }
}